/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ronin.model;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Version;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author esimsek
 */
@Entity
@Table(name = "musteri")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Musteri.findAll", query = "SELECT m FROM Musteri m"),
    @NamedQuery(name = "Musteri.findById", query = "SELECT m FROM Musteri m WHERE m.id = :id"),
    @NamedQuery(name = "Musteri.findByImei", query = "SELECT m FROM Musteri m WHERE m.imei = :imei"),
    @NamedQuery(name = "Musteri.findByAd", query = "SELECT m FROM Musteri m WHERE m.ad = :ad"),
    @NamedQuery(name = "Musteri.findBySoyad", query = "SELECT m FROM Musteri m WHERE m.soyad = :soyad"),
    @NamedQuery(name = "Musteri.findByEmail", query = "SELECT m FROM Musteri m WHERE m.email = :email"),
    @NamedQuery(name = "Musteri.findByGsm", query = "SELECT m FROM Musteri m WHERE m.gsm = :gsm")})
public class Musteri implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id")
    private Long id;
    @Column(name = "imei")
    private BigInteger imei;
    @Basic(optional = false)
    @Column(name = "ad")
    private String ad;
    @Basic(optional = false)
    @Column(name = "soyad")
    private String soyad;
    @Column(name = "email")
    private String email;
    @Column(name = "gsm")
    private String gsm;
    @OneToOne(mappedBy = "musteri")
    private Arac arac;
    @OneToMany(cascade = CascadeType.REFRESH, mappedBy = "musteri")
    private List<MusteriUrun> musteriUrunList;
    @OneToMany(cascade = CascadeType.REFRESH, mappedBy = "musteri")
    private List<MusteriHizmet> musteriHizmetList;
    @OneToMany(cascade = CascadeType.REFRESH, mappedBy = "musteri")
    private List<MusteriRandevu> musteriRandevuList;

    @Version
    private int versiyon;

    
    public Musteri() {
    }

    public Musteri(Long id) {
        this.id = id;
    }

    public Musteri(Long id, String ad, String soyad) {
        this.id = id;
        this.ad = ad;
        this.soyad = soyad;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public BigInteger getImei() {
        return imei;
    }

    public void setImei(BigInteger imei) {
        this.imei = imei;
    }

    public String getAd() {
        return ad;
    }

    public void setAd(String ad) {
        this.ad = ad;
    }

    public String getSoyad() {
        return soyad;
    }

    public void setSoyad(String soyad) {
        this.soyad = soyad;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getGsm() {
        return gsm;
    }

    public void setGsm(String gsm) {
        this.gsm = gsm;
    }

    public Arac getArac() {
        return arac;
    }

    public void setArac(Arac arac) {
        this.arac = arac;
    }

    @XmlTransient
    public List<MusteriUrun> getMusteriUrunList() {
        return musteriUrunList;
    }

    public void setMusteriUrunList(List<MusteriUrun> musteriUrunList) {
        this.musteriUrunList = musteriUrunList;
    }

    @XmlTransient
    public List<MusteriHizmet> getMusteriHizmetList() {
        return musteriHizmetList;
    }

    public void setMusteriHizmetList(List<MusteriHizmet> musteriHizmetList) {
        this.musteriHizmetList = musteriHizmetList;
    }

    @XmlTransient
    public List<MusteriRandevu> getMusteriRandevuList() {
        return musteriRandevuList;
    }

    public void setMusteriRandevuList(List<MusteriRandevu> musteriRandevuList) {
        this.musteriRandevuList = musteriRandevuList;
    }

    public int getVersiyon() {
        return versiyon;
    }

    public void setVersiyon(int versiyon) {
        this.versiyon = versiyon;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Musteri)) {
            return false;
        }
        Musteri other = (Musteri) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ronin.model.Musteri[ id=" + id + " ]";
    }
    
}
